package com.zmn.mcc.services.impl.role;

import com.zmn.common.dictionary.GlobalDict;
import com.zmn.common.dto.StatusDTO;
import com.zmn.common.utils.date.DateUtil;
import com.zmn.mcc.model.entity.role.McRoleSys;
import com.zmn.mcc.persistence.interfaces.role.RoleSysDao;
import com.zmn.mcc.services.interfaces.role.RoleSysService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author heguanghua
 * @since 2020/04/14 21:27
 */
@Service
public class RoleSysServiceImpl implements RoleSysService {

    @Resource
    private RoleSysDao roleSysDao;


    @Override
    public McRoleSys findByKey(Integer roleId, Integer sysId) {
        McRoleSys roleSys = new McRoleSys();
        roleSys.setRoleId(roleId);
        roleSys.setSysId(sysId);
        return this.findByKey(roleSys);
    }
    @Override
    public McRoleSys findByKey(McRoleSys roleSys) {
        return roleSysDao.findByKey(roleSys);
    }

    @Override
    public List<Integer> listSysIdByRoleId(Integer roleId) {
        return roleSysDao.listSysIdByRoleId(roleId);
    }

    @Override
    public List<Integer> listSysIdByStaffId(Integer staffId) {
        return roleSysDao.listSysIdByStaffId(staffId);
    }

    @Override
    public Integer countByQuery(McRoleSys roleSys) {
        return roleSysDao.countByQuery(roleSys);
    }



    @Override
    public Integer insert(McRoleSys roleSys) {
        return roleSysDao.insert(roleSys);
    }

    @Override
    public Integer insertByBatch(List<McRoleSys> roleSyses) {
        return roleSysDao.insertByBatch(roleSyses);
    }



    @Override
    public Integer deleteByKey(Integer roleId, Integer sysId) {
        McRoleSys roleSys = new McRoleSys();
        roleSys.setRoleId(roleId);
        roleSys.setSysId(sysId);
        return this.deleteByKey(roleSys);
    }
    @Override
    public Integer deleteByKey(McRoleSys roleSys) {
        return roleSysDao.deleteByKey(roleSys);
    }

    @Override
    public Integer deleteByRoleId(Integer roleId) {
        McRoleSys roleSys = new McRoleSys();
        roleSys.setRoleId(roleId);
        return this.deleteByQuery(roleSys);
    }
    @Override
    public Integer deleteBySysId(Integer sysId) {
        McRoleSys roleSys = new McRoleSys();
        roleSys.setSysId(sysId);
        return this.deleteByQuery(roleSys);
    }
    @Override
    public Integer deleteByQuery(McRoleSys roleSys) {
        return roleSysDao.deleteByQuery(roleSys);
    }
}
